%Plots the welfare gains to arbitrage for all 5 currencies over the period
%for which we have microstructure estimates (late 2019-early 2021)
function fig_CIP_welfareGDPRobust(datesExtras, selectorNonHolidays, WelfareArbs, optfig)

if optfig.plotfig == 1
    
    [fontname,dimension,lw,folder,color,style,marker,markersize,fontsize_tit,fontsize_ax,fontsize_lab,fontsize_leg] = fn_optfig(optfig);
    
    f0 = figure('Units','inches','Position',dimension);
    
    GDPVec = (23.315e12+[1.552e12 3.131e12 1.988e12 14.56e12 4.941e12])/365;
    
    plot(datesExtras(selectorNonHolidays,:),abs(WelfareArbs(:,1))*100*1e6/GDPVec(1),'Color',color{1},'LineStyle',style{1},'LineWidth',lw); hold on;
    plot(datesExtras(selectorNonHolidays,:),abs(WelfareArbs(:,3))*100*1e6/GDPVec(2),'Color',color{3},'LineStyle',style{2},'LineWidth',lw); hold on;
    plot(datesExtras(selectorNonHolidays,:),abs(WelfareArbs(:,5))*100*1e6/GDPVec(3),'Color',color{4},'LineStyle',style{3},'LineWidth',lw); hold on;
    plot(datesExtras(selectorNonHolidays,:),abs(WelfareArbs(:,7))*100*1e6/GDPVec(4),'Color',color{5},'LineStyle',style{4},'LineWidth',lw); hold on;
    plot(datesExtras(selectorNonHolidays,:),abs(WelfareArbs(:,9))*100*1e6/GDPVec(5),'Color',color{6},'LineStyle',style{5},'LineWidth',lw); hold on;

    dateaxis('x',2)
    ytickformat('%g')
    yticks(0:0.25:1.75)
    xlabel('Date','interpreter','latex','FontSize',fontsize_ax,'FontName',fontname)
    ylabel('Welfare Gains (percent of Daily GDP)','interpreter','latex','FontSize',fontsize_ax,'FontName',fontname)
    title('Normalized Welfare Gains','interpreter','latex','FontSize',fontsize_tit,'FontName',fontname)
    grid; axis tight; box off;
    
    legendCell = {'AUD', 'GBP', 'CAD', 'EUR', 'JPY'};
    legend(legendCell,'interpreter','latex','FontSize',fontsize_leg,'FontName',fontname,'Location','best')
    legend boxoff
end

name = '02_WelfareGainsGDPRobust';
print(f0,'-depsc','-painters','-noui','-r600',[folder,name,'.eps'])

end